function onUse(cid, item, frompos, item2, topos)
if item2.itemid == 0 then
doPlayerSendCancel(cid,"Você não pode fazer isso.")
else
if getTilePzInfo(getCreaturePosition(cid)) then
return doPlayerSendCancel(cid, "O item nao tem poder em Protection Zones.")
elseif getTileHouseInfo(getCreaturePosition(cid)) then
return doPlayerSendCancel(cid, "O item nao tem poder em Casas.")
elseif getPlayerAccess(cid) >= 0 then
local playerpos = getPlayerPosition(cid)
local check = true
for i=playerpos.x, topos.x do
for j=playerpos.y, topos.y do
local pos = {x=i,y=j,z=playerpos.z}
if not isWalkable(pos) then
check = false
end
end
end
if check then
doTeleportThing(cid,topos)
doSendMagicEffect(playerpos,2)
doSendMagicEffect(topos,10)
doSendAnimatedText(playerpos,"Teleport",35)
doPlayerAddMana(cid, -1500)
else
doPlayerSendCancel(cid,"Você não pode atravessar isso.")
end
else
doPlayerSendCancel(cid,"Você não pode usar esta runa.")
end
end
return true
end
function isWalkable(pos, creature, pz, proj) -- nord
if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false end
local creature = getTopCreature(pos)
if creature.type > 0 then return false end
if getTilePzInfo(pos) and not pz then return false end
local n = not proj and 3 or 2
for i = 0, 255 do
pos.stackpos = i
local tile = getTileThingByPos(pos)
if tile.itemid ~= 0 and not isCreature(tile.uid) then
if hasProperty(tile.uid, n) or hasProperty(tile.uid, 7) then
return false
end
end
end
return true
end
Obs: nem testei ![]()






info
Grupo: Barão
Registrado: 26/12/11
Posts: 201
Reputação: +18
Char no Tibia: Flaah
Boa Tarde amigos do XTibia, to om um pequeno problema nessa action, que seria:
O player pode se teleporta entre as paredes, teria como arruma isso?!
ALGUEM AJUDA PORFAVOR, VALENDO +REP